<template>
  <div class="card" @click="toDetailPage(web.websiteId)" ref="card">
    <div class="card-img">
      <el-image :src="web.icon" fit="fill" />
    </div>

    <div class="card-info">
      <p class="text-title">{{ web.name }} </p>
      <p class="text-body">{{ web.web_description }}</p>
    </div>

    <div class="card-footer">
      <div class="card-tags">
          <el-tag type="success">{{web.tags}}</el-tag>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import router from "../router";

defineProps({
  web: Object
})
// console.log('web',props.web)
const toDetailPage=(websiteId:number)=>{
  // router.push('/webDetailPage')
  const newPage = router.resolve({
    path: '/webDetailPage',  // 跳转的页面路由
    query:{
      websiteId:websiteId,
    }
  })
  window.open(newPage.href, '_blank') // 打开新的窗口(跳转路径，跳转类型)
}

</script>

<style scoped>
.el-divider{
  margin: 0;
}
a{
  text-decoration: none;
  color: #252525;
}
.el-image{
  width: 80%;
  height: 50%;
  padding-top: 15%;
  padding-left: 10%;
  padding-right: 10%;
}
.card {
  width: 190px;
  height: 260px;
  padding: 1.2rem;
  background: #ffffff;
  position: relative;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  margin: 10px 25px ;
}

.card-img {
  background-color: rgba(121, 175, 220, 0.85);
  height: 50%;
  width: 100%;
  border-radius: .5rem;
  transition: .3s ease;
}

.card-info {
  padding-top: 10%;
}
.card-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #ddd;
}

/*Text*/
.text-title {
  cursor: pointer;
  font-weight: 900;
  font-size: 1.2em;
  line-height: 1.5;
  margin:10px 0;
}

.text-body {
  cursor: pointer;
  font-size: .6em;
  /*padding-bottom: 10px;*/
  margin:10px 0;
  overflow: hidden;
  text-overflow:ellipsis;
  white-space: nowrap;
  color: grey;
}

/*Hover*/
.card-img:hover {
  transform: translateY(-25%);
  box-shadow: rgba(226, 196, 63, 0.25) 0 13px 47px -5px, rgba(180, 71, 71, 0.3) 0 8px 16px -8px;
}
.text-title:hover{
  color: dodgerblue;
}


</style>